on filltemplate templatelist, textline, mydelimiter
set delimiter to default(the itemDelimiter, mydelimiter)
delpush(delimiter)
if the number of items in textline <> count(templatelist) then
set error to "The number of items in the line starting '" & char 1 to 20 of textline & "...' doesn't match the template count (currently " & count(templatelist) & " items)."
return error
end if
set filledlist to [:]
repeat with index = 1 to the number of items in textline